// created on 8/11/2005 at 10:26 AM
// project created on 8/10/2005 at 7:59 AM
using System;
using System.IO;
using System.Collections;
using System.Text;
using System.Text.RegularExpressions;
using SysReport;

namespace SysReport
{	
	public class RPM
	{
		public static string [] Packages ()
		{
			System.Diagnostics.Process proc = new System.Diagnostics.Process();
			proc.EnableRaisingEvents=false;
			proc.StartInfo.RedirectStandardOutput = true;
			proc.StartInfo.UseShellExecute = false;
			proc.StartInfo.FileName="rpm";
			proc.StartInfo.Arguments="-qa";
			
			// Get packages from rpm
			proc.Start();
			string buffer = proc.StandardOutput.ReadToEnd();
			proc.WaitForExit();
			
			// Split results on any number of spaces
			string [] packages = System.Text.RegularExpressions.Regex.Split(buffer, "\n");
			return packages;
		}
	}
}
